define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {

		function get_data_groupbuy_list(result) {
			if(HTTP_ISLOGIC) {
				result = '{"success":true,"msg":"","result":{"act":[{"act_id":"act_id_001","name":"新年促销","start_time":"2017/01/01 09:00:00","end_time":"2017/01/31 09:00:00","image":{"id":"001","image":"./img/upload/pro-img01.jpg"}},{"act_id":"act_id_002","name":"新年促销","start_time":"2017/01/01 09:00:00","end_time":"2017/01/31 09:00:00","image":{"id":"001","image":"./img/upload/pro-img01.jpg"}}]},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else
				return result;
		}
		//返回信息
		return {
			//获取首页数据
			groupbuy_list: function(status,callback) {
				//post请求
				Http.post({
					method: 'marketing.groupbuy.getlist',
					session: '',
					from_type: 2,
					pagelimit: 8,
					nPage: 1,
					show_count: 5,
					status:status
				}, function(result) {
					//函数回调
					if(callback)
						callback(get_data_groupbuy_list(result).result);
				});
			},
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Mygroupbuy_agent", factory);
});
